package com.project.lk.nurseapp.inputfiles;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.bigkoo.pickerview.TimePickerView;
import com.project.lk.nurseapp.R;
import com.project.lk.nurseapp.base.BaseActivity;
import com.project.lk.nurseapp.utils.AppManager;
import com.project.lk.nurseapp.utils.KeyboardUtils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
 * 功能介绍：记录体温
 * 项目名：
 * 模块名称：
 * 作者：LK
 * 日期：2018/1/9
 * 修改日期：
 */
public class InputThermomterActivity extends BaseActivity {


    @BindView(R.id.time_tv)
    TextView timeTv;
    @BindView(R.id.input_edit)
    EditText inputEdit;

    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {
        setTime();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_input_thermomter;
    }


    @OnClick({R.id.back, R.id.time_layout,R.id.finish_tv})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.back:
                AppManager.getAppManager().finishActivity();
                break;
            case R.id.time_layout:
                KeyboardUtils.hideKeyboard(this);
                mTimePickerView.show();
                break;
            case R.id.finish_tv://完成
                break;
        }
    }

    private TimePickerView mTimePickerView;
    public void setTime() {
        //设置时间显示在文本上
        mTimePickerView = new TimePickerView.Builder(this, new TimePickerView.OnTimeSelectListener() {
            @Override
            public void onTimeSelect(Date date, View v) {

                SimpleDateFormat format = new SimpleDateFormat("HH:mm ", Locale.CHINA);
                timeTv.setText(format.format(date));

            }
        }).setCancelColor(getResources().getColor(R.color.heard_background))
                .setSubmitColor(getResources().getColor(R.color.heard_background))
                .isCyclic(true)
                .setType(TimePickerView.Type.HOURS_MINS).build();
    }
}
